<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>审核列表(平台)</title>
    <link rel="stylesheet" type="text/css" th:href="@{easyui/themes/default/easyui.css}">
    <link rel="stylesheet" type="text/css" th:href="@{easyui/themes/icon.css}">
    <script type="text/javascript" th:src="@{easyui/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{easyui/jquery.easyui.min.js}"></script>
	<script type="text/javascript">
	    //工具栏
	    var toolbar = [{
	        text: '审核',
	        iconCls: 'icon-edit',
	        handler: function () {
	            $('#dd').dialog('open');}

	    }];
	   $(function(){
	       $('#booklist').datagrid({  
				title:'审核列表',  
				iconCls:'icon-save',   
				url:'/manager/examine/findByCondition',
				columns:[
				    [
					{field:'title',title:'审核标题',width:100,align:'center'},
					{field:'info',title:'审核详情',width:200,align:'center'},
					{field:'flag',title:'审核状态',width:80,align:'center',formatter:function(val,row,index){
                            //val 当前field属性中的值
                            //row 当前行的党项信息
                            if(val == 0){
                                return "未审核";
                            }
                            if(val == 1){
                                return "审核通过";
                            }
                            if(val == 2){
                                return "审核不通过";
                            }
                            return '数据丢失';
                        }},
					{field:'bookname',title:'书籍详情',width:200,align:'center',formatter:function(value,row,index){
					          return "<a href='javascript:openshowbook("+row.bookid+")'>查看</a>";
					}}					
				]
                ],
				toolbar: toolbar,  
				pagination: true,//表示在datagrid设置分页              
               	pageSize: 5,
				singleSelect:true,
                pageList: [5,10,20]
			});
           $("#selectByCondition").click(function () {
               $('#booklist').datagrid({
                   queryParams:{
                       bookname:$("#bookName").val(),
                       ISBN:$("#ISBN").val()
                   }
               })
           });

		 //初始化查询栏
		 $("#submit_search").linkbutton({ iconCls: 'icon-search', plain: true })
            .click(function () {
                $('#dg').datagrid({ queryParams: form2Json("searchform") });   //点击搜索
            });
          
          //初始化修改窗口  
         $('#dd').dialog({
			    title: 'My Dialog',
			    width: 700,
			    height: 500,
			    closed: true,
			    cache: false,
			    href: '',
			    modal: true,
			    iconCls: 'icon-save',
                buttons: [{
                    text:'提交',
                    iconCls:'icon-ok',
                    handler:function(){
                        var row=$('#booklist').datagrid('getSelected');
                        $('#dd').dialog('open');
                        $('#id').val(row.id);
                        $('#bookId').val(row.bookId);
                        $('#number1').val(row.number);
                        $('#supplierId').val(row.supplierId);
                        $('#ff').prop('action','/manager/examine/modifyExamine')
                        $('#ff').submit();

                    }
                },{
                    text:'关闭',
                    handler:function(){
                        $('#dd').dialog("close");

                    }
                }]
			});

           $('#showbook').dialog({
               title:'mydialog',
               width:700,
               height: 500,
               closed: true,
               cache: false,
               modal:true,
               iconCls: 'icon-save'
           });
	   });

        function openshowbook(id) {
            $.ajax({
                url:"/manager/examine/findAllBook",
                type:"post",
                dataType:"json",
                data:{
                    id:id
                },
                success:function (data) {
                    $.each(data,function (name,value) {
                        $("#"+name).textbox("setValue",value);
                    });
                    $('#showbook').dialog("open")
                }
            });
        }
	</script>
</head>
<body>
   <form name="searchform" method="post" action="" id ="searchform">
    <td width="70" height="30"><strong>审核查询：</strong></td>
    <td height="30">
        <input type="text" name="keyword" id="bookName" size=20 placeholder="书籍名称"/>
        <input type="text" name="keyword"  id="ISBN" size=20 placeholder="ISBN"/>
		<select name="search_type" id="search_type" >
            <option value="-1">请选择供应商</option>
            <option value="be_name" >供应商1</option>
            <option value="be_intro">供应商2</option>
            <option value="be_intro">供应商3</option>
        </select>
    </td>
	<td>
	  <button type="button" id="selectByCondition">查询</button>
	</td>
  </form>
  <table id="booklist"></table>
    <div id="dd">
           <div align="center" style="margin-top: 30px">
            <form id="ff" method="post">
                <input type="text" id="id" name="id" hidden>
                <input type="text" id="bookId" name="bookId" hidden>
                <input type="text" id="number1" name="number" hidden>
                <input type="text" id="supplierId" name="supplierId" hidden>
             <table>
			    <tr>
				   <td>
				      审核状态:
				   </td>
				   <td>
						<select name="flag" id="search_type" style="width:100px">
							<option value="1">通过</option>
							<option value="0">不通过</option>
						</select>
				   </td>
				</tr>
				<tr style="vertical-align:top">
				   <td>
				      审核详情:
				   </td>
				   <td>
				     <textarea rows="10" cols="30" name="info"></textarea>
				   </td>
				</tr>
			 </table>			
        </form>
           </div>
    </div>
   <div id="showbook">
       <div align="center" style="margin-top: 30px">

           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="bookname" style="width:50%" data-options="label:'书籍名称:',required:true">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="iSBN" style="width:50%" data-options="label:'ISBN:',required:true,validType:'email'">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="price" style="width:50%" data-options="label:'单价:',required:true,validType:'email'">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="number" style="width:50%" data-options="label:'数量:',required:true,validType:'email'">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="groupprice" style="width:50%" data-options="label:'团购价:',required:true">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="layout" style="width:50%" data-options="label:'版次:',required:true">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="register" style="width:50%" data-options="label:'册数:',required:true">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="weight" style="width:50%" data-options="label:'重量:',required:true">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="bookintroduce" style="width:50%;height:60px" data-options="label:'书籍简介:',multiline:true">
           </div>
           <div style="margin-bottom:20px">
               <input class="easyui-textbox" id="authorintroduce" style="width:50%;height:60px" data-options="label:'作者简介:',multiline:true">
           </div>
           <div style="margin-bottom:20px">
               封面图片:&nbsp;&nbsp;&nbsp;&nbsp; <input  type="file" id="file"/>
           </div>

       </div>
   </div>
</body>
</html>